Insomnia Content Analysis¶

This notebook fosters the reproducibility of the following paper:

  • Julien Coelho, Maria Montserrat, Vincent P. Martin, Christophe Gauld, Alexandre Richaud, Régis Lopez, Marie Pelou, Poeiti Abi-Saab, Pierre Philip, Pierre-Alexis Geoffroy, Laura Palagini, Jean-Arthur Micoulaud-Franchi. A symptom content analysis of self-report questionnaire of insomnia disorder severity. Under review

If you want to compute the same metrics with you own data, we redirect you towards our generic content analysis GitHub https://github.com/vincentpmartin/generic_content_analysis

⚠️ PLEASE READ BEFORE DOING ANYTHING ⚠️¶

Welcome to this online coding environment ! You are currently running a Jupyter notebook that we hope to be usefull for content analysis of questionnaires.

Each cell can be ran individually (pressing the "Play" ▶ button or pressing CTRL+ENTER in the each cell). In order to make everything run smoothly, it is strongly recommended to run them in order.

RECOMMANDED: You can also run all the cells at the same time : "Run" → "Run All Cells".

At the end of the execution, you will have the opportunity to save all yours results in an HTML file, executing "File" → "Save and Export Notebook as" → "HTML"

If you have chosen to run every cell individually, please begin by running the following cell that imports all the required package for our code to work correctly ↓

Category Subcategory Ab Symptom ISI MISS JSS BIS AIS WHIIRS SCI RIS ISQ
0 Insomnia symptoms NaN S001 Insomnia initiating 1 1 1 1 1 1 1 1 1
1 Insomnia symptoms NaN S002 Insomnia maintaining 1 1 1 1 1 1 1 1 1
2 Insomnia symptoms NaN S003 Insomnia early 1 0 2 1 1 1 0 1 0
3 Related insomnia symptoms NaN S004 Sleep satisfaction 1 0 0 1 1 1 1 1 0
4 Related insomnia symptoms NaN S005 Non restorative sleep 0 1 0 1 0 0 0 1 1

1. Analysis of the number and frequency of symptoms¶

In a first step, we analyse the frequency of the symptoms.

Histogram of number of symptoms¶

Sorted by number of occurences¶

The figure has been save in the online folder (📁 symbol on the left) under the name figure1_histogram_1.pdf.
You can change the name and the format of the file changing the name in the fig.write_image() function.
⚠️ If you need it, save the figure on your local computer : these online file will be deleted as soon as you quit this page!

Sorted by category¶

The figure has been save in the online folder (📁 symbol on the left) under the name figure2_histogram_2.pdf.
You can change the name and the format of the file changing the name in the fig.write_image() function.
⚠️ If you need it, save the figure on your local computer : these online file will be deleted as soon as you quit this page!

Number of symptoms by questionnaire¶

Specific symptoms Compound symptoms Total
ISI 5 6 11
RIS 10 0 10
SCI 4 5 9
ISQ 9 0 9
BIS 5 3 8
AIS 8 0 8
JSS 3 1 4
WHIIRS 4 0 4
MISS 3 0 3

The table has been save in the online folder (📁 symbol on the left) under the name table1_symptoms_per_questionnaire.xlsx.
You can change the name and the format of the file changing the name in the sympt_per_questionnaire.to_excel() function.
⚠️ If you need it, save the excel file on your local computer : these online file will be deleted as soon as you quit this page!

Symptoms that are in classifications but not in questionnaires¶

References list is empty

Number of symptoms in each category for each questionnaire¶

ISI RIS SCI ISQ BIS AIS JSS WHIIRS MISS
Insomnia symptoms 3 3 2 2 3 3 3 3 2
Related insomnia symptoms 2 4 1 1 2 1 0 1 1
Daytime symptoms 3 0 4 4 2 1 1 0 0
Functional repercussion 3 1 2 2 1 2 0 0 0
Sleep timing 0 2 0 0 0 1 0 0 0

The table has been save in the online folder (📁 symbol on the left) under the name table2_categorie_per_questionnaire.xlsx.
You can change the name and the format of the file changing the name in the cat_per_questionnaire.T.to_excel() function.
⚠️ If you need it, save the excel file on your local computer : these online file will be deleted as soon as you quit this page!

Distribution across the categories of the symptoms measured by each questionnaire¶

(i.e. same thing as before, but normalized by questionnaire (sum across lines equals 1)).

Figure 3 has been save in the online folder (📁 symbol on the left) under the name figure3_heatmap.pdf. You can change the name and the format of the file changing the name in the fig.write_image() function.
⚠️ If you need it, save the figure on your local computer : these online file will be deleted as soon as you quit this page!


2. Analysis and data vizualisation of content analysis Figure¶

Content Analysis Figure¶

The figure has been save in the online folder (📁 symbol on the left) under the name figure4_radial.pdf. You can change the name and the format of the file changing the name in the fig.write_image() function.
⚠️ If you need it, save the figure on your local computer : these online file will be deleted as soon as you quit this page!

Overlap between questionnaires - Jaccard Index¶

In order to estimate the overlap between the symptoms measured by the questionnes, calculate the Jaccard index, which is defined as the number of symmtoms that are measured by both questionnaires, divided by the number of unique symptoms measured both questionnaires.

Jaccard index of symptom for each pair of questionnaire¶

First, we compute the Jaccard index for each pair of questionnaires and plot it using a heatmap.

ISI RIS SCI ISQ BIS AIS JSS WHIIRS MISS
ISI 1.000000 0.400000 0.666667 0.538462 0.461538 0.461538 0.363636 0.363636 0.166667
RIS 0.400000 1.000000 0.266667 0.266667 0.384615 0.500000 0.272727 0.400000 0.300000
SCI 0.666667 0.266667 1.000000 0.800000 0.545455 0.545455 0.300000 0.300000 0.200000
ISQ 0.538462 0.266667 0.800000 1.000000 0.545455 0.416667 0.300000 0.181818 0.333333
BIS 0.461538 0.384615 0.545455 0.545455 1.000000 0.600000 0.500000 0.500000 0.375000
AIS 0.461538 0.500000 0.545455 0.416667 0.600000 1.000000 0.333333 0.500000 0.222222
JSS 0.363636 0.272727 0.300000 0.300000 0.500000 0.333333 1.000000 0.600000 0.400000
WHIIRS 0.363636 0.400000 0.300000 0.181818 0.500000 0.500000 0.600000 1.000000 0.400000
MISS 0.166667 0.300000 0.200000 0.333333 0.375000 0.222222 0.400000 0.400000 1.000000

Table 3 has been save in the online folder (📁 symbol on the left) under the name table3_jaccard_pairs.xlsx.
You can change the name and the format of the file changing the name in the jaccard_table.to_excel() function.
⚠️ If you need it, save the excel file on your local computer : these online file will be deleted as soon as you quit this page!

The figure has been save in the online folder (📁 symbol on the left) under the name figure5_heatmap_jaccard.pdf.
You can change the name and the format of the file changing the name in the fig.write_image() function.
⚠️ If you want it, save the figure on your local computer : these online file will be deleted as soon as you quit this page!

Avg. Jaccard index¶

Then, we compute the average of Jaccard index for each questionnaire with other questionnaires (excluding the references).

Avg. Jaccard Index
ISI 0.427768
RIS 0.348834
SCI 0.453030
ISQ 0.422800
BIS 0.489008
AIS 0.447402
JSS 0.383712
WHIIRS 0.405682
MISS 0.299653
Average Jaccard index (wo references): 0.40865 (sd: 0.0576)

Table 4 has been save in the online folder (📁 symbol on the left) under the name table4_jaccard_average_questionnaires.xlsx.
You can change the name and the format of the file changing the name in the jaccard.to_excel() function.
⚠️ If you need it, save the excel file on your local computer : these online file will be deleted as soon as you quit this page!

Correlation between the number of symptoms and the average Jacquart index for each questionnaire¶

Avg. Jaccard Index Specific symptoms Compound symptoms Total
ISI 0.427768 5 6 11
RIS 0.348834 10 0 10
SCI 0.453030 4 5 9
ISQ 0.422800 9 0 9
BIS 0.489008 5 3 8
AIS 0.447402 8 0 8
JSS 0.383712 3 1 4
WHIIRS 0.405682 4 0 4
MISS 0.299653 3 0 3
Correlation between Jaccard Index and number of specific symptoms:  SpearmanrResult(correlation=0.21098736814243052, pvalue=0.5858071253332076)
Correlation between Jaccard Index and number of compound symptoms:  SpearmanrResult(correlation=0.5659799760886717, pvalue=0.11216498551662016)
Correlation between Jaccard Index and total number of symptoms:  SpearmanrResult(correlation=0.3375797890278888, pvalue=0.37429460976889506)

Jaccard index of symptoms for each pair of questionnaire for each category¶

Computing the same metric (average of average) for each category of questionnaires.

Avg. Jaccard Index
Insomnia symptoms 0.833333
Related insomnia symptoms 0.377976
Daytime symptoms 0.405556
Functional repercussion 0.577778
Sleep timing 0.500000

Table 5 has been save in the online folder (📁 symbol on the left) under the name table5_jaccard_categories.xlsx.
You can change the name and the format of the file changing the name in the res.to_excel() function.
⚠️ If you need it, save the excel file on your local computer : these online file will be deleted as soon as you quit this page!

Sunburst Plots¶

Unweighted sunburst plot¶

The figure has been save in the online folder (📁 symbol on the left) under the name figure6_sunburst_plot.pdf.
You can change the name and the format of the file changing the name in the fig.write_image() function.
⚠️ If you want it, save the figure on your local computer : these online file will be deleted as soon as you quit this page!

Sunburst weighted by number of occurence of symptoms¶

The figure has been save in the online folder (📁 symbol on the left) under the name figure7_sunburst_plot.pdf.
You can change the name and the format of the file changing the name in the fig.write_image() function.
⚠️ If you want it, save the figure on your local computer : these online file will be deleted as soon as you quit this page!

Weighted by number of occurence * number of citations¶

Category Subcategory Ab Symptom ISI RIS SCI ISQ BIS AIS JSS WHIIRS MISS sum_symptoms
0 Insomnia symptoms NaN S001 Insomnia initiating 5977 98 557 188 346 1353 1139 255 72 9985
1 Insomnia symptoms NaN S002 Insomnia maintaining 5977 98 557 188 346 1353 1139 255 72 9985
2 Insomnia symptoms NaN S003 Insomnia early 5977 98 0 0 346 1353 2278 255 0 10307
3 Related insomnia symptoms NaN S004 Sleep satisfaction 5977 98 557 0 346 1353 0 255 0 8586
7 Daytime symptoms NaN S008 Fatigue 11954 0 1114 188 692 0 1139 0 0 15087
11 Functional repercussion NaN S012 Self complaints of distress 11954 98 557 188 0 1353 0 0 0 14150
12 Functional repercussion NaN S013 Self complaints of disabilities 11954 0 1114 188 692 1353 0 0 0 15301
4 Related insomnia symptoms NaN S005 Non restorative sleep 0 98 0 188 346 0 0 0 72 704
8 Daytime symptoms NaN S009 Daytime sleepiness 0 0 1114 188 692 1353 0 0 0 3347
9 Daytime symptoms NaN S010 Cognitive symptoms 11954 0 1114 188 0 0 0 0 0 13256
10 Daytime symptoms NaN S011 Affective symptoms 11954 0 1114 188 0 0 0 0 0 13256
5 Related insomnia symptoms NaN S006 Worying about sleep 11954 98 0 0 0 0 0 0 0 12052
14 Sleep timing NaN S015 Sleep duration 0 98 0 0 0 1353 0 0 0 1451
6 Related insomnia symptoms NaN S007 Sleeping pills intake 0 98 0 0 0 0 0 0 0 98
13 Functional repercussion NaN S014 Distress reported by others 5977 0 0 0 0 0 0 0 0 5977
15 Sleep timing NaN S016 Time in bed 0 98 0 0 0 0 0 0 0 98

The figure has been save in the online folder (📁 symbol on the left) under the name figure8_sunburst_plot.pdf.
You can change the name and the format of the file changing the name in the fig.write_image() function.
⚠️ If you want it, save the figure on your local computer : these online file will be deleted as soon as you quit this page!


Export to html¶

You have reached the end of this notebook. If you want to save the whole page, you can download it to html with dynamic figures:

  • "File" → "Save and Export Notebook as" → "HTML"